//
//  DockButton.m
//  团购
//
//  Created by 樊荣海 on 15/1/20.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "DockButton.h"

@implementation DockButton {

    UIImageView *_seper;
}


- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self == [super initWithFrame:frame]) {
        
        //1.顶部分割线
        _seper = [[UIImageView alloc] init];
        _seper.frame = CGRectMake(0, 0, DockItemW, 2);
        _seper.image = [UIImage imageNamed:@"separator_tabbar_item"];
        [self addSubview:_seper];

    }
    
    return self;
}

- (void)setImage:(NSString *)image selectedImage:(NSString *)selectedImage {

    [self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [self setImage:[UIImage imageNamed:selectedImage] forState:UIControlStateDisabled];
}

- (void)setTopLine:(BOOL)topLine {
    
    _seper.hidden = topLine;
}

- (void)setBottomLine:(BOOL)bottomLine {

    if (bottomLine) {
        //2.底部分割线
        UIImageView *seper = [[UIImageView alloc] init];
        seper.frame = CGRectMake(0, DockItemH-2, DockItemW, 2);
        seper.image = [UIImage imageNamed:@"separator_tabbar_item"];
        [self addSubview:seper];
    }
}


- (void)setHighlighted:(BOOL)highlighted {}

//宽度写死
- (void)setFrame:(CGRect)frame {
    
    frame.size = CGSizeMake(DockItemW, DockItemH);
    [super setFrame:frame];
}

- (void)setBounds:(CGRect)bounds {
    
    bounds.size = CGSizeMake(DockItemW, DockItemH);
    [super setBounds:bounds];
}
@end
